import request from '@/utils/request';

/**
 * 查询配送区域列表
 */
export async function selectDistributionList(params) {
  return request(`/server/api/mds/mds-distribution/selectMdsDistributionList`, {
    method: 'POST',
    body: params,
  });
}
//查询配送区域列表 ： 层级结构
export async function selectFirstDistribution(params) {
  return request(`/server/api/mds/mds-distribution/selectFirstDistribution`, {
    method: 'POST',
    body: params,
  });
}
//区域列表（层级结构）
export async function selectMdsDistList(params) {
  return request(`/server/api/mds/mds-distribution/selectMdsDistList`, {
    method: 'POST',
    body: params,
  });
}
//详情
export async function distributionDetail(params) {
  return request(
    `/server/api/mds/mds-distribution/viewMdsDistributionDetails`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
/**
 * 新增编辑
 */
export async function distributionOperate(params) {
  const url = params.id
    ? 'mds-distribution/updateMdsDistribution'
    : 'mds-distribution/insertMdsDistribution';

  return request(
    `/server/api/mds/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
//启用禁用
export async function ableOperate(params) {
  const url = params.type
    ? 'mds-distribution/enableMdsDistribution'
    : 'mds-distribution/disableMdsDistribution';

  return request(
    `/server/api/mds/${url}`,
    {
      method: 'POST',
      body: params,
    },
    true
  );
}
//删除：
export async function deleteDistribution(params) {
  return request(`/server/api/mds/mds-distribution/deleteMdsDistribution`, {
    method: 'POST',
    body: params,
  });
}
